package com.wc.alorithm_blue_bridge._数学知识.约数.Q2209;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/11/20-11:08
 * 近似gcd
 * https://www.lanqiao.cn/problems/2209/learning/?page=1&first_category_id=1&name=%E8%BF%91%E4%BC%BC
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();

        int n = sc.nextInt();
        int g = sc.nextInt();
        int maxN = 100005;
        int[] array = new int[maxN];
        /**
         * 前面第一个不是g的整数倍的坐标
         */
        int[] pre = new int[maxN];
        long ans = 0;
        /**
         * 计算ans表示前面的是包含该位置的数一共有多少
         */
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
            if (array[i] % g > 0) {
                pre[i + 1] = i;
                ans += i - pre[i] - 1;
            } else {
                pre[i + 1] = pre[i];
                ans += i - pre[pre[i]] - 1;
            }
        }
        System.out.println(ans);
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
